package java6681.single;

public class Bank6681 {
    static String bankName; // 将银行名称定义静态变量
    private String name ;//储户姓名
    private String password ;//密码
    private double balance ;//账户余额
    private double turnover ;//交易额

    static void welcome(){
        //银行对用户到来的欢迎动作
        System.out.println("欢迎来到"+bankName+"-------------");
    }

    public Bank6681(String name, String password, double turnover){
        //用户开户动作
        this.name = name;
        this.password = password;
        this.turnover = turnover;
        this.balance = turnover - 10;
        System.out.println(name+" 开户成功，账户余额 "+balance);
    }

    public void deposit(double turnover){
        //用户的存款动作
        balance = balance + turnover;
        System.out.println(name+"您好，您的账户 已存入"+turnover+"元，"
                + "当前余额 "+balance+" 元");
    }

    public void withdrawal( String password,double turnover){
        //用户的取款动作
        //根据传入的变量与成员变量比对，判断密码是否正确
        if(this.password != password){
            System.out.println("您输入的密码错误！");
            return;
        }
        //判断余额是否充足
        if(balance - turnover >  0){
            balance = balance - turnover;
            System.out.println(name+"您好，您的账户 已取出"+turnover+"元，"
                    + "当前余额 "+balance+" 元");
        }else{
            System.out.println("对不起，账户余额不足！");
        }
    }

    static void welcomeNext(){
        //银行对用户离开的提醒动作
        System.out.println("请携带好随身财物，欢迎下次光临"+bankName+"-------------");
    }
}
